package 设计模式.创建型模式.demo03生成器模式.流式生成demo;

import 设计模式.创建型模式.demo03生成器模式.cars.CarType;
import 设计模式.创建型模式.demo03生成器模式.components.Engine;
import 设计模式.创建型模式.demo03生成器模式.components.GPSNavigator;
import 设计模式.创建型模式.demo03生成器模式.components.TripComputer;

/**
 * @author: 王富贵
 * @description: 流式生成器主管方法
 * @createTime: 2022/11/07 14:46
 */
public class FlowDirector {
    public void constructSportsCar(FlowCarBuilder builder) {
        builder
                .setCarType(CarType.SPORTS_CAR)
                .setSeats(2)
                .setEngine(new Engine(3.0, 0))
                .setTripComputer(new TripComputer())
                .setGPSNavigator(new GPSNavigator());
    }

    public void constructCityCar(FlowCarBuilder builder) {
        builder
                .setCarType(CarType.CITY_CAR)
                .setSeats(2)
                .setEngine(new Engine(1.2, 0))
                .setTripComputer(new TripComputer())
                .setGPSNavigator(new GPSNavigator());
    }

    public void constructSUV(FlowCarBuilder builder) {
        builder
                .setCarType(CarType.SUV)
                .setSeats(4)
                .setEngine(new Engine(2.5, 0))
                .setGPSNavigator(new GPSNavigator());
    }
}
